/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.softace.jdbc.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is declared over classes that have to be mapped with a table
 * or entity in a database.<br>Important Note: The Class annotated with this
 * annotation must have a default no-arguments constructor.<br>The example
 * usage of this annotation is given below:
 * <pre><code>
 * &#064;JdbcEntity(tableName = "person")
 * public class PersonBean {
 *
 *     public PersonBean() {
 *     }
 *
 *     &#064;JdbcAttribute(columnName = "id", isKeyForMap = true)
 *     int id;
 *     &#064;JdbcAttribute(columnName = "name")
 *     String name;
 * }</code></pre>
 *
 * @author s1lent_warrior
 */
@Documented
@Target(value = ElementType.TYPE)
@Retention(value = RetentionPolicy.RUNTIME)
public @interface JdbcEntity {

    /**
     * The name of the table that has to be mapped with the annotated class
     *
     * @return the table name
     */
    public String tableName();

    /**
     * The parent class of the annotated if its parent is also JdbcEntity
     * annotated.<br>The example usage of this optional attribute is given
     * below:
     * <pre><code>
     * &#064;JdbcEntity(tableName = "person")
     * public class PersonEntity {
     *     &#064;JdbcAttribute(columnName = "id", isKeyForMap = true)
     *     int id;
     *     &#064;JdbcAttribute(columnName = "name")
     *     String name;
     * }
     *
     * &#064;JdbcEntity(tableName = "person", parentEntityClass = PersonEntity.class)
     * public class StudentEntity extends PersonEntity {
     *     &#064;JdbcAttribute(columnName = "contact_number")
     *     String contactNumber;
     * }</code></pre>
     *
     * @return the class of parent entity
     */
    public Class<?> parentEntityClass() default JdbcEntity.class;
}
